{{ csrf_field() }}
<div class="box-body">
    <div class="form-group">
        <label for="name">姓名</label>
        <input type="text" name="name" value="{{ $user->name or old('name') }}" class="form-control" id="name" placeholder="姓名">
    </div>
    <div class="form-group">
        <label for="mail">邮箱</label>
        <input type="text" name="email" value="{{ $user->email or old('email') }}" class="form-control" id="mail" placeholder="邮箱">
    </div>
    @if( auth()->user()->can('show-user-roles') || auth()->user()->can('edit-user-roles') )
        <div class="form-group">
            <label>角色</label><br>
            @if(isset($roles))
                @foreach( $roles as $role )
                    <input type="checkbox" {{ $user->hasRole($role->name) ? 'checked' :'' }} name="roles[]" value="{{ $role->name }}" id="{{ $role->name }}" class="flat-red" > <label for="{{ $role->name }}"> {{ $role->cn_name }}</label>
                    <br>
                @endforeach
            @endif
        </div>

        <div class="form-group">
            <label for="permissions">权限列表</label>
            <div class="row">
                @include('permission._edit_block')
            </div>
        </div>
    @endif

</div>
<div class="box-footer">
    @can('edit-user')
        <button type="submit" class="btn btn-primary">保存</button>
    @endcan
    <button type="button" onclick="javascript:window.history.back()" class="btn btn-default">返回</button>
</div>

@section('Style')
    <link href="https://cdn.bootcss.com/iCheck/1.0.1/skins/all.css" rel="stylesheet">
@endsection

@section('JavascriptResult')
    <script src="https://cdn.bootcss.com/iCheck/1.0.1/icheck.min.js"></script>
@endsection

@section('JavascriptScript')
    $('input[type="checkbox"].flat-red').iCheck({
        checkboxClass: 'icheckbox_flat-green',
        radioClass   : 'iradio_flat-green'
    });
@endsection